//
//  ViewController.m
//  DatePick和UIbar
//
//  Created by song on 15/1/20.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIDatePicker *picker =[[UIDatePicker alloc]init];
    picker.datePickerMode = UIDatePickerModeDate;
    picker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"];
    
    UIToolbar *tool =[[UIToolbar alloc]init];
    tool.frame =CGRectMake(0, 0, 320, 60);
//    tool.backgroundColor= [UIColor redColor];
//    tool.tintColor =[UIColor redColor];
//    tool.barTintColor =[UIColor redColor];
    
    UIBarButtonItem *item1 =[[UIBarButtonItem alloc]initWithTitle:@"上一个" style:UIBarButtonItemStylePlain target:self action:@selector(preclick)];
    
    UIBarButtonItem *item2 =[[UIBarButtonItem alloc]initWithTitle:@"下一个" style:UIBarButtonItemStylePlain target:self action:@selector(nexclick)];
    
    UIBarButtonItem *item3 =[[UIBarButtonItem alloc]initWithTitle:nil style:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    
    UIBarButtonItem *item4 =[[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(downclick)];
    
    tool.items=@[item1 ,item3 ,item2,item4];
    
    self.inputfield.inputAccessoryView = tool;
    
    self.inputfield.inputView = picker;
}

-(void)preclick
{
    
}

-(void)nexclick
{
    
}

-(void)downclick
{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
